# -*- coding: utf-8 -*-
# @Time: 2024/12/20 16:38
# @Author: foxhuty
# @File: mysql_notes.py

from sqlalchemy import create_engine
import pandas as pd
import os

file_path = r'D:\data_test_files\成都十一中高2024级高一半期考试.xlsx'


def save_into_sql(file, db_name, tb_name):
    df = pd.read_excel(file, sheet_name=0)
    engine = create_engine(f'mysql+pymysql://hutysql:foxmmer123@119.3.180.189:3306/{db_name}')
    conn = engine.connect()
    df.to_sql(con=conn, index=False, if_exists='replace', name=tb_name)
    conn.close()


if __name__ == '__main__':
    # save_into_sql(file_path, 'huty_db', '高2024级高一半期考试成绩')
    print(os.getpid(),os.getppid())
